import request from '@/utils/request'

// 查询客户信息列表
export function listInfo(query) {
  return request({
    url: '/prod-api/customer/Info/list',
    method: 'get',
    params: query
  })
}

export function listInfoSelf(query) {
  return request({
    url: '/prod-api/customer/Info/listSelf',
    method: 'get',
    params: query
  })
}


// 查询客户信息详细
export function getInfo(customerUid) {
  return request({
    url: '/prod-api/customer/Info/' + customerUid,
    method: 'get'
  })
}

// 新增客户信息
export function addInfo(data) {
  return request({
    url: '/prod-api/customer/Info',
    method: 'post',
    data: data
  })
}

// 修改客户信息
export function updateInfo(data) {
  return request({
    url: '/prod-api/customer/Info',
    method: 'put',
    data: data
  })
}

// 删除客户信息
export function delInfo(customerUid) {
  return request({
    url: '/prod-api/customer/Info/' + customerUid,
    method: 'delete'
  })
}

// 修改客户状态
export function updateCustomerStatus(customerUid, status){
  const data = {
    customerUid,
    status
  }
  return request({
    url: '/prod-api/customer/Info/updateCustomerStatus',
    method: 'put',
    data: data
  })
}

/**
 * 根据id查询客户信息
 */
export function getCustomerInfoByids(queryCustomerInfoParams,customerUid) {
  return request({
   url: '/prod-api/customer/Info/getCustomerInfoByids/' + customerUid,
    method: 'get',
	 params: queryCustomerInfoParams
  })
}

/**
 * 根据id查询客户绑定等级历史记录
 */
export function getLevelInfoHistory(historyQueryParams,customerUid) {
  return request({
    url: '/prod-api/customer/Info/getLevelInfoHistory/' + customerUid,
    method: 'get',
    params: historyQueryParams
  })
}

/**
 * 根据id查询客户账号信息
 */
export function getCustomerAccount(customerUid) {
  return request({
   url: '/prod-api/customer/Info/getCustomerAccount/' + customerUid,
    method: 'get'
  })
}

/**
 * 锁定或启动账号信息
 */
export function updateAccountStatus(data) {
  return request({
    url: '/prod-api/customer/customerAccount/updateAccountStatus',
    method: 'post',
    data: data
  })
}
/**
 * 锁定或启动指定账号信息
 */
export function updateAccountStatusById(customerAccountUid,accountStatus) {
  const data = {
    customerAccountUid,
    accountStatus
  }
  return request({
    url: '/prod-api/customer/customerAccount/updateAccountStatusById',
    method: 'post',
    data: data
  })
}

/**
 * 查看分享者小程序码
 */
export function getSharecustomerQrCode(customerUid) {
  return request({
    url: '/prod-api/customer/Info/getSharecustomerQrCode/' + customerUid,
    method: 'get'
  })
}

//查询对应用户的卡包集合
export function listBuyRecord(customerUid,query) {
  return request({
    url: '/prod-api/customer/Info/listBuyRecord/' + customerUid,
    method: 'get',
    params: query
  })
}

// 查询客户卡包统计
export function getStatisticsByUid(customerUid) {
  return request({
    url: '/prod-api/customer/Info/getStatisticsByUid/' + customerUid,
    method: 'get'
  })
}

//查询客户各个门店的资金
export function listFundStore(customerUid,query) {
  return request({
    url: '/prod-api/customer/Info/listFundStore/' + customerUid,
    method: 'get',
    params: query
  })
}

// 查询客户资金
export function getFundByUid(customerUid) {
  return request({
    url: '/prod-api/customer/Info/getFundByUid/' + customerUid,
    method: 'get'
  })
}

//查询客户的消费记录
export function listConsumptionByUid(customerUid,query) {
  return request({
    url: '/prod-api/customer/Info/listConsumptionByUid/' + customerUid,
    method: 'get',
    params: query
  })
}

// 查询用户的消费统计
export function getConsumptionStatics(customerUid) {
  return request({
    url: '/prod-api/customer/Info/getConsumptionStatics/' + customerUid,
    method: 'get'
  })
}

//查询客户档案
export function recirdListByUid(customerUid) {
  return request({
    url: '/prod-api/customer/Info/recirdListByUid/' + customerUid,
    method: 'get'
  })
}
